<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStoreOrderInvoiceTable extends Migration
{
    /**
     * Run the migrations.
     *发票表
     * @return void
     */
    public function up()
    {
        Schema::create('store_order_invoice', function (Blueprint $table) {
            $table->id()->comment('订单发票表');
            $table->integer('user_id')->index()->comment('用户id');
            $table->integer('order_id')->index()->comment('订单id');
            $table->string('name')->nullable()->comment('名称（发票抬头）');
            $table->string('duty_number')->nullable()->comment('税号');
            $table->string('drawer_phone')->comment('开票人手机号');
            $table->string('email')->comment('开票人邮箱');
            $table->string('tell')->comment('注册电话');
            $table->string('address')->comment('注册地址');
            $table->string('bank')->comment('开户行');
            $table->string('card_number')->comment('银行卡号');
            $table->integer('type')->comment('发票类型：0电子普通发票  1纸质专用发票');
            $table->integer('header_type')->comment('抬头类型 :0个人1企业');
            $table->tinyInteger('is_pay')->comment('是否支付:0未支付 1已支付(默认)');
            $table->tinyInteger('is_refund')->comment('订单是否退款：0未退款 1已退款(默认)');
            $table->tinyInteger('is_invoice')->comment('是否开票:0未开票  1已开票 (默认)');
            $table->string('invoice_number')->comment('开票票号');
            $table->string('remark')->comment('备注');
            $table->timestamp('invoice_time')->comment('开票时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('store_order_invoice');
    }
}
